/*
 * @Author: 2112778581 2112778581@qq.com
 * @Date: 2023-10-16 10:13:29
 * @LastEditors: asanupup 15465106+asanupup@user.noreply.gitee.com
 * @LastEditTime: 2025-09-23 14:11:39
 * @FilePath: \pra\libs\db\src\models\news.model.ts
 * @Description: 留下联系信息的用户
 */
import { ApiProperty } from '@nestjs/swagger';
import { modelOptions, prop } from '@typegoose/typegoose';
import { IsNotEmpty, Allow, IsOptional } from 'class-validator';

@modelOptions({
  // 自动为每个属性添加时间戳
  schemaOptions: {
    timestamps: true,
  },
})
export class AttemptCustomer {
  @ApiProperty({ description: 'ip' })
  @IsOptional()
  @prop()
  ip: string;

  @ApiProperty({ description: '城市' })
  @IsOptional()
  @prop()
  cityName: string;

  @ApiProperty({ description: '电话' })
  @IsNotEmpty({ message: '电话不能为空' })
  @prop()
  telephone: string;

  @ApiProperty({ description: 'email' })
  @IsOptional()
  @prop()
  email: string;

  @ApiProperty({ description: '单位名称' })
  @IsOptional({ message: '单位名称不能为空' })
  @prop()
  corporation: string; // 单位名称

  @ApiProperty({ description: '留言内容' })
  @IsOptional({ message: '留言内容不能为空' })
  @prop()
  content: string; // 留言内容

  @ApiProperty({ description: '产品名称' })
  @IsOptional({ message: '产品名称不能为空' })
  @prop()
  productionName: string; // 产品名称

  @ApiProperty({ description: '产品Id' })
  @IsOptional({ message: '产品Id不能为空' })
  @prop()
  productionId: string; // 产品Id

  @ApiProperty({ description: '客户姓名' })
  @IsOptional()
  @prop()
  customerName: string; // 客户姓名

  @ApiProperty({ description: 'hours 24进制的时间' })
  @IsOptional()
  @prop()
  hours: string;

  @ApiProperty({ description: '日期时间' })
  @IsOptional()
  @prop()
  day: string;

  @ApiProperty({ description: '月份时间' })
  @IsOptional()
  @prop()
  month: string;

  @ApiProperty({ description: '年份' })
  @IsOptional()
  @prop()
  year: string;

  @ApiProperty({ description: '是否已联系' })
  @IsOptional()
  @prop()
  contacted: '0' | '1' | ''; // 是否已联系

  @ApiProperty({ description: '高质量用户' })
  @IsOptional()
  @prop()
  highQuality: '0' | '1' | ''; // 高质量用户

  @ApiProperty({ description: '已购买产品' })
  @IsOptional()
  @prop()
  buyed: '0' | '1' | ''; // 已购买产品

  @ApiProperty({ description: '购入金额' })
  @IsOptional()
  @prop()
  buyedAmount: string; // 购入金额

  @Allow()
  _id: string;

  @Allow()
  createdAt: string;

  @Allow()
  updatedAt: string;

  @Allow()
  __v: string;
}
